package org.study.springboot.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.study.springboot.entity.TLimitUpDetail;
import org.study.springboot.service.TLimitUpDetailService;

import javax.annotation.Resource;

/**
 * (TLimitUpDetail)表控制层
 *
 * @author makejava
 * @since 2024-01-09 23:17:00
 */
@RestController
@RequestMapping("tLimitUpDetail")
public class TLimitUpDetailController {
    /**
     * 服务对象
     */
    @Resource
    private TLimitUpDetailService tLimitUpDetailService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public ResponseEntity<TLimitUpDetail> queryById(@PathVariable("id") String id) {
        return ResponseEntity.ok(this.tLimitUpDetailService.queryById(id));
    }

    /**
     * 新增数据
     *
     * @param tLimitUpDetail 实体
     * @return 新增结果
     */
    @PostMapping
    public ResponseEntity<TLimitUpDetail> add(TLimitUpDetail tLimitUpDetail) {
        return ResponseEntity.ok(this.tLimitUpDetailService.insert(tLimitUpDetail));
    }

    /**
     * 编辑数据
     *
     * @param tLimitUpDetail 实体
     * @return 编辑结果
     */
    @PutMapping
    public ResponseEntity<TLimitUpDetail> edit(TLimitUpDetail tLimitUpDetail) {
        return ResponseEntity.ok(this.tLimitUpDetailService.update(tLimitUpDetail));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping
    public ResponseEntity<Boolean> deleteById(String id) {
        return ResponseEntity.ok(this.tLimitUpDetailService.deleteById(id));
    }

}

